import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;

/**
 * Created with IntelliJ IDEA.
 * Description: 按照字符进行读操作
 */
public class FileTest10 {
    public static void main(String[] args) {
        try(Reader reader = new FileReader("d:/test.txt")) {
            while(true) {
                char[] buffer = new char[1024];
                int count = reader.read(buffer);
                if(count == -1) {
                    break;
                }
                String ret = new String(buffer, 0, count);
                System.out.println(ret);
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
